﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;

using Shifter.Utils;

namespace Shifter.Selectors
{
    public class MethodSelector : MultipleSelector<MethodInfo>
    {
        public override IEnumerable<MethodInfo> Select(IShifterContext context)
        {
            Assume.ArgumentNotNull(context, "context");

            return new List<MethodInfo>
            (
                context.TypeToResolve
                    .GetTypeInfo()
                    .DeclaredMethods
                    .Where(m => m.IsDefined(typeof(InjectAttribute), false))
            );
        }
    }
}